﻿using System;
using Deferred.Library.Scene.Utilities;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace Deferred.Library.Scene
{
    /// <summary>
    /// 
    /// </summary>
    public class Terrain
    {
        [ContentSerializer(Optional = true)]
        private string heightmapName;

        /// <summary>
        /// 
        /// </summary>
        public event EventHandler OnHeightmapNameChanged;

        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public Vector3 Position { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public TerrainGenerationData GenerationData { get; private set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializer(Optional = true)]
        public TerrainTexturePack TexturePack { get; private set; }
        /// <summary>
        /// 
        /// </summary>
        [ContentSerializerIgnore]
        public string HeightmapName
        {
            get { return heightmapName; }
            set { heightmapName = value; if (OnHeightmapNameChanged != null) OnHeightmapNameChanged(this, EventArgs.Empty); }
        }

        /// <summary>
        /// 
        /// </summary>
        public Terrain()
            : this(new TerrainGenerationData(), "", new TerrainTexturePack(), Vector3.Zero) { }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="generationData"></param>
        /// <param name="heightmapName"></param>
        /// <param name="texturePack"></param>
        /// <param name="position"></param>
        public Terrain(TerrainGenerationData generationData, string heightmapName, TerrainTexturePack texturePack, Vector3 position)
        {
            this.GenerationData = generationData;
            this.heightmapName = heightmapName;
            this.TexturePack = texturePack;
            this.Position = position;
        }


    }
}
